home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / AmiVoGL_MDEV.lha / hershey / src / fdisp.c < prev    next >
C/C++ Source or Header  |  1994-04-12  |  930b  |  69 lines

  1. #include <stdio.h>
  2. #ifdef SGI
  3. #include <gl.h>
  4. #include <device.h>
  5. #else
  6. #include "vogl.h"
  7. #include "vodevice.h"
  8. #endif
  9.  
  10. #include "hershey.h"
  11.  
  12. /*
  13.  *    displays every character in a hershey font at 64 characters
  14.  * per screen. Note: this program reads the binary format as created
  15.  * by h2v.
  16.  */
  17. int main(
  18.   int ac,
  19.   char **av)
  20. {
  21.     char    dev[50];
  22.     int    i, nchars;
  23.     float    x, y;
  24.     short    val;
  25.  
  26.     if (ac != 2) {
  27.         fprintf(stderr, "fdisp: usage fdisp fontname\n");
  28.         exit(1);
  29.     }
  30.  
  31.     winopen("fdisp");
  32.     ortho2(-1.0, 1.0, -1.0, 1.0);
  33.     qdevice(KEYBD);
  34.     color(BLACK);
  35.     clear();
  36.  
  37.     color(GREEN);
  38.  
  39.     hfont(av[1]);
  40.  
  41.     nchars = hnumchars();
  42.  
  43.     htextsize(0.2, 0.2);
  44.  
  45.     x = -0.94;
  46.     y = 0.77;
  47.     for (i = 0; i < nchars; i++) {
  48.         move2(x, y);
  49.         hdrawchar(' ' + i);
  50.         x += 0.25;
  51.         if (x > 0.86) {
  52.             y -= 0.25;
  53.             if (y < -1.1) {
  54.                 qread(&val);
  55.                 color(BLACK);
  56.                 clear();
  57.                 color(GREEN);
  58.                 y = 0.77;
  59.             }
  60.             x = -0.94;
  61.         }
  62.     }
  63.  
  64.     qread(&val);
  65.  
  66.     gexit();
  67. }
  68.  
  69.